﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Server.ActivityFeed;
using Microsoft.Office.Server.UserProfiles;

namespace ESF.SharePoint.Domain
{
    public class QueryActivity : IQueryActivity
    {

        UserProfile _userProfile;

        public QueryActivity()
        {}
        
        public QueryActivity(UserProfile userProfile)
        {
            _userProfile = userProfile;
        }
        
        // Mine
        public ActivityEventsCollection GetActivitiesByMe()
        {
            QueryActivityManagerContext context = new QueryActivityManagerContext();
            ActivityManager am = context.GetInstance(_userProfile);
            ActivityEventsCollection activities = am.GetActivitiesByMe();
            return activities;
        }

        // From that User
        public ActivityEventsCollection GetActivitiesByUser(string user)
        {
            QueryActivityManagerContext context = new QueryActivityManagerContext();
            ActivityManager am = context.GetInstance(_userProfile);
            ActivityEventsCollection activities = am.GetActivitiesByUser(user);
            return activities;
        }

        // From that userProfile
        //public ActivityEventsCollection GetActivitiesByUser(UserProfile userProfile)
        //{
        //    ActivityManagerContext context = new ActivityManagerContext();
        //    ActivityManager am = context.GetInstance();
        //    ActivityEventsCollection activities = am.GetActivitiesByUser(userProfile);
        //    return activities;
        //}

        // From my network
        public ActivityEventsCollection GetActivitiesForMe()
        {
            QueryActivityManagerContext context = new QueryActivityManagerContext();
            ActivityManager am = context.GetInstance(_userProfile);
            ActivityEventsCollection activities = am.GetActivitiesForMe();
            return activities;
        }
 
    }
}
